import std.stdio: writefln;

import derelict.sdl.sdl;
import ImageIO;

public class ImageI:ImageIO{
	bool lmb = false, rmb = false;

	this(int h, int w, uint bg, uint fg){
		super(h, w, bg, fg);
	}

	void keyUp(int k){
		if(k == SDL_BUTTON_LEFT)
			lmb = false;
		else if(k == SDL_BUTTON_RIGHT)
			rmb = false;
	}

	void keyDown(int k){
        if(k == SDL_BUTTON_LEFT)
            lmb = true;
        else if(k == SDL_BUTTON_RIGHT)
            rmb = true;
	}

	void mouseMotion(int x, int y){
//		writefln(x," - ",y);
		if(lmb)
			pixels[y/scale][x/scale] = foreground;
		else if(rmb)
			pixels[y/scale][x/scale] = background;
	}

}
